<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .first{
            /* 给父级添加flex属性 */
            display: flex;
            width: 800px;
            height: 700px;
            background-color: pink;
            /* 默认的主轴是x轴 侧轴是y轴 */
            /* 我们的元素是按照主轴排列的 */
            flex-direction: row;
            /* 翻转 */
            /* flex-direction: row-reverse; */
            /* 我们可以把主轴设置为y轴 那么x轴就变成了侧轴 */
            /* flex-direction: column; */
            /* justify-content: 是设置主轴上子元素的排列方式 */
            /* justify-content: flex-end; */
            /* 让子元素居中对齐 */
            /* justify-content: center; */
            /* 平分剩余空间 */
            /* justify-content: space-around; */
            /* 先两边贴边，在将剩余空间分配 */
            justify-content: space-between;
            /* flex布局中，默认的子元素是不换行的，如果装不开，会缩小 */
            flex-wrap: wrap;
            /* 我们需要一个侧轴居中 */
            /* align-items: center; */
            /*因为有了换行，此时我们侧轴上控制子元素的对齐方式为align-content  */
            /* align-content: flex-start; */
            align-content: space-between;
        
        }
        .first span{
            width: 150px;
            height: 100px;
            background-color: purple;
            margin: 10px;
        }
        section{
            display: flex;
            width: 60%;
            height:150px;
            background-color: pink;
            margin:0 auto;
            flex-direction: row;
        }
        section div:nth-child(1){
            width: 100px;
            height: 150px;
            background-color: red;
        }
        section div:nth-child(2){
            flex:1;
            background-color: greed;
        }
        section div:nth-child(3){
            width: 100px;
            height: 150px;
            background-color: red;
            
        }
        p{
            display: flex;
            width: 60%;
            height:150px;
            background-color: pink;
            margin:0 auto;
            flex-direction: row;
        }
        p span{
            flex:1;
            height: 50%;
            background-color: rgb(168, 47, 47);
        }
        p span:nth-child(2){
            flex:2;
            background-color: green;
            align-self: flex-end;
            order: -1;
            
            
        }
    </style>
</head>
<body>
    <div class="first">
        <span>1</span>
        <span>2</span>
        <span>3</span>
        <span>4</span>
        <span>5</span>
        <span>6</span>
        <span>7</span>
        <span>8</span>
    </div>

    <section>
        <div></div>
        <div></div>
        <div></div>
    </section>
    <p>
        <span>1</span>
        <span>2</span>
        <span>3</span>
    </p>
</body>
</html>